package com.vietnam.power.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;

import com.vietnam.power.constant.PageConstants;
import com.vietnam.power.domain.ProductDTO;
import com.vietnam.power.service.ProductService;

public abstract class AbstractController {

	@Autowired
	private ProductService productService;

	// retrieve model and view. add category object to mav
	public ModelAndView retriveModelAndViewWithCategory(String pageName) {
		ModelAndView mav = new ModelAndView(pageName);
		
	//	mav.addObject(PageConstants.CATEGORY, productService.getAllCategories());
		return mav;
	}
	// retrieve model and view. add category object to mav
	public ModelAndView retriveModelAndViewWithProduct(String pageName,ProductDTO product) {
		ModelAndView mav = new ModelAndView(pageName);
		mav.addObject("productDetail",product);product.getLocation();
	//	mav.addObject(PageConstants.CATEGORY, productService.getAllCategories());
		return mav;
	}
	// retrieve model and view.
	public ModelAndView retriveModelAndView(String pageName) {
		ModelAndView mav = new ModelAndView(pageName);

		return mav;
	}
}
